package com.leo.controller;


import com.leo.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @ClassName: GetUserInfoRestfulController
 * @Description: ${description}
 * @Author: leo825
 * @Date: 2020-01-02 17:36
 * @Version: 1.0
 */
@Controller
public class GetUserInfoStringController{

    @Autowired
    UserInfoService userInfoService;

    @RequestMapping("/getUserInfoList2")
    public ModelAndView getUserInfoList2(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
        System.out.println("注解方式GetUserInfoStringController获取用户信息");
        List userInfoList = userInfoService.getUserInfoList();
        System.out.println(userInfoList);
        httpServletResponse.setCharacterEncoding("UTF-8");
        httpServletResponse.setContentType("text/html;charset=UTF-8");
        httpServletResponse.getWriter().write(userInfoList.toString());
        return null;
    }
}
